<?php
    $this->model = new Models_Contacts();
	$this->content->begin();
	$this->html->loadJs('Scripts/jquery.validate.min.js');
?>
<div class="content_Title">
	<span class="cat-title white">
	<?php if ($_SESSION['clang'] == 'vi-VN'):?>
		Dịch vụ khách hàng - Gửi liên hệ	
	<?php else:?>
		Customer - Send contact
	<?php endif;?>
	</span>
</div>
<div class="content-container">
	<h3>
	<?php if ($_SESSION['clang'] == 'vi-VN'):?>
		Mọi thắc mắc về sản phẩm, vui lòng liên hệ với chúng tôi theo các thông tin sau:
	<?php else:?>
		Contact us with information bellow
	<?php endif;?>
	</h3>
	<table>
	<?php foreach ($arrInfor as $infor):?>
		<tr>
			<td class="label-contact"><?php echo $infor->title?>:</td>
			<td><?php echo $infor->value?></td>
		</tr>
	<?php endforeach;?>		
	</table>
	<div class="line"></div>
	<h3>
		<?php if ($_SESSION['clang'] == 'vi-VN'):?>
		Hoặc bạn có thể trực tiếp gửi liên hệ cho chúng tôi theo mẫu sau:
		<?php else:?>
		Or you can send message for us by this form:
		<?php endif;?>
	</h3>
	<?php $this->form->begin('frmContact')?>
		<table>
			<tr>
				<td class="label-contact"><?php echo $this->resource->full_name?>: </td>
				<td><?php $this->form->textboxFor('full_name')?></td>
			</tr>
			<tr>
				<td class="label-contact"><?php echo $this->resource->email_address?>:</td>
				<td><?php $this->form->textboxFor('email', array('class' => 'large'))?></td>
			</tr>
			<tr>
				<td class="label-contact"><?php echo $this->resource->phone?>:</td>
				<td><?php $this->form->textboxFor('phone')?></td>
			</tr>
			<tr>
				<td class="label-contact"><?php echo $this->resource->address?>:</td>
				<td><?php $this->form->textboxFor('address', array('class' => 'large'))?></td>
			</tr>
			<tr>
				<td class="label-contact"><?php echo $this->resource->title?>:</td>
				<td><?php $this->form->textboxFor('title', array('class'=>'larger'))?></td>
			</tr>
			<tr>
				<td class="label-contact"><?php echo $this->resource->content?>:</td>
				<td><?php $this->form->textareaFor('content', array('rows'=> 10, 'cols' => 50))?></textarea></td>
			</tr>
		</table>
		<div class="loading" id="Loading"></div>
		<div class="message success" id="SuccessMessage">
		<?php if ($_SESSION['clang'] == 'vi-VN'):?>
			Gửi liên hệ thành công! Chúng tôi sẽ liên hệ với bạn trong thời gian sớm nhất!
		<?php else:?>
			Send message successfully! We'll response for you as soon as possible!
		<?php endif;?>	
		</div>
		<div class="command-btn"><input type="submit" value="<?php echo $this->resource->send_contact?>"/> <input type="button" value="<?php echo $this->resource->cancel?>"/></div>
	<?php $this->form->end()?>
</div>
<script type="text/javascript">
$("#frmContact").submit(function(){
	if ($(this).valid())
	{
		var data = {
				full_name: $("#full_name").val(),
				email: $("#email").val(),
				address: $("#address").val(),
				phone: $("#phone").val(),
				title: $("#title").val(),
				content: $("#content").val()
		};
		$("#Loading").show();
		$.ajax({
			url: "<?php echo $this->url->action('create','Index', 'Contacts')?>",
			data: data,
			dataType: "json",
			type: "POST",
			success: function(response)
			{
				$("#Loading").hide();
				if (response.success)
				{
					$("#SuccessMessage").show();
				}
			}
		});
	}
	return false;
});
</script>
<?php $this->form->scriptRegistrar()?>
<?php $this->content->end()?>
<?php $this->section->begin('breadcrumb')?>
<div>Trang chủ</div>
<div class="separator"></div>
<div>Gửi thông tin liên hệ</div>
<?php $this->section->end()?>